#37 new
Julien Palmas

why aasm_initial_state :initial => :pending in Authorization::AasmRoles ?

Reported by Julien Palmas | January 30th, 2009 @ 08:19 AM

Authorization::AasmRoles has the following on line 13 (as of sha 61cd9b3) :

aasm_initial_state :initial => :pending

Am I right saying this line is useless, and wrong ?

It looks a lot like the acts_as_state_machine routine :

acts_as_state_machine :initial => :pending

Anyhow, if this line has a use I'd have missed, it's not covered by the rpec tests. Comment the line, run the specs, and see it all pass.

Comments and changes to this ticket

  • Luke Pearce

    Luke Pearce March 18th, 2010 @ 12:08 PM

    • Tag set to state_machine

    I must admit this seems odd to me too - shouldn't a user initially be passive? Either that or the state_machine_roles.rb and other authorization files need amending:

    event :register do
      transition :passive => :pending, :if => Proc.new {|u| !(u.crypted_password.blank? && u.password.blank?) }
    end
    

    According to that bit of code; to register a user you are only supposed to transition from a passive state to a pending state anyway (i.e. You'll get an StateMachine::InvalidTransition otherwise)

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Restful Authentication Generator

This widely-used plugin provides a foundation for securely managing user
authentication:
* Login / logout
* Secure password handling
* Account activation by validating email
* Account approval / disabling by admin
* Rudimentary hooks for authorization and access control.

http://github.com/technoweenie/restful-authentication/tree

People watching this ticket

Pages